import request from '@/util/request'
// 操作表格数据
let tableCz = {
    data: function () {
        return {
            tableData: [], // 表格的数据
            loading: true, // 表格是否加载成功
            total: 0 // 总数量
        }
    },
    methods: {
        // 获取表格数据
        async getlist() {
            let kkjs = JSON.parse(JSON.stringify(this.csk))
            this.loading = true
            let res = await request.zhycpost(this.TableView.url, kkjs)
            this.loading = false
            this.total = res.total
            this.tableData = res.obj
        },
        // 分页的pageSize 改变时会触发
        sizechange(e) {
            this.csk.limit = e
            this.getlist()
        },
        // currentPage 改变时会触发
        currentChange(e) {
            this.csk.page = e
            this.getlist()
        },
        // 重置按钮触发
        async congzhibtn() {
            for (let key in this.csk) {
                if (key != 'page' && key != 'limit') {
                    this.$set(this.csk, key, '');
                }
            }
            this.jknmxe = ''
            this.getlist()
        }
    },
    mounted() {

        this.getlist()
    }
}
export default {
    tableCz
}
